﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bubble2 : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject G1;
    public GameObject G2;
    public string G1name;
  
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    private void FixedUpdate()
    {
        CheckSpilt();
    }

    void CheckSpilt()
    {
        if(G1!=null&&G2!=null)
        {
            if ((G1.transform.position - G2.transform.position).magnitude > 7.2f)
            {
                Destroy(gameObject);
                //G1.SetActive(true);
                //G2.SetActive(true);
            }
        }
    }

    public GameObject getG1()
    {
        return G1;
    }
    public GameObject getG2()
    {
        return G2;
    }
    public void SetG1(GameObject g1)
    {
        G1 = g1;
    }
    public void SetG2(GameObject g2)
    {
        G2=g2;
    }
}
